<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
var runningSum = function(nums) {
    for( var i = 1 ; i<nums.length ; i++ ){
        nums[i] = nums[i] + nums[i-1]
    }
    return nums
};

var nums = [3,1,2,10,1]
console.log(runningSum(nums))
    </script>
</body>
</html>